﻿using System;

namespace MinMaxAverageProductSum
{
    class MinMaxAverageProductSum
    {
        static int MinElement(params int[] array)
        {
            int minElement = array[0];
            for (int index = 1, length = array.Length; index < length; index++)
            {
                if (minElement > array[index])
                {
                    minElement = array[index];
                }
            }
            return minElement;
        }
        static int MaxElement(params int[] array)
        {
            int maxElement = array[0];
            for (int index = 1, length = array.Length; index < length; index++)
            {
                if (maxElement < array[index])
                {
                    maxElement = array[index];
                }
            }
            return maxElement;
        }
        static int Average(params int[] array)
        {
            int average = array[0];
            for (int index = 1, length = array.Length; index < length; index++)
            {
                average += array[index];
            }
            return average / array.Length;
        }
        static int Sum(params int[] array)
        {
            int sum = array[0];
            for (int index = 1, length = array.Length; index < length; index++)
            {
                sum += array[index];
            }
            return sum;
        }
        static int Product(params int[] array)
        {
            int product = array[0];
            for (int index = 1, length = array.Length; index < length; index++)
            {
                product *= array[index];
            }
            return product;
        }
        static void Main()
        {
            int[] input = { 1, 2, 3, 4, 5 };
            Console.WriteLine("MinElement: {0}", MinElement(input));
            Console.WriteLine("MaxElement: {0}", MaxElement(input));
            Console.WriteLine("Sum: {0}", Sum(input));
            Console.WriteLine("Product: {0}", Product(input));
            Console.WriteLine("Average: {0}", Average(input));
        }
    }
}
